/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package arkin.impl;

import arkin.AND;
import arkin.ActionDifferentialWheel;
import arkin.ActionLED;
import arkin.ActionPen;
import arkin.Arbiter;
import arkin.ArkinFactory;
import arkin.ArkinPackage;
import arkin.Behavior;
import arkin.Color;
import arkin.Constante;
import arkin.DifferentialWheel;
import arkin.DistanceSensor;
import arkin.EQUAL;
import arkin.EntryState;
import arkin.FSM;
import arkin.GT;
import arkin.GTE;
import arkin.LED;
import arkin.LT;
import arkin.LTE;
import arkin.LightSensor;
import arkin.NOT;
import arkin.OR;
import arkin.Pen;
import arkin.Robot;
import arkin.State;
import arkin.TouchSensor;
import arkin.Transition;
import arkin.XOR;
import arkin.*;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EDataType;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EPackage;

import org.eclipse.emf.ecore.impl.EFactoryImpl;

import org.eclipse.emf.ecore.plugin.EcorePlugin;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model <b>Factory</b>.
 * <!-- end-user-doc -->
 * @generated
 */
public class ArkinFactoryImpl extends EFactoryImpl implements ArkinFactory {
	/**
	 * Creates the default factory implementation.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public static ArkinFactory init() {
		try {
			ArkinFactory theArkinFactory = (ArkinFactory)EPackage.Registry.INSTANCE.getEFactory("arkin"); 
			if (theArkinFactory != null) {
				return theArkinFactory;
			}
		}
		catch (Exception exception) {
			EcorePlugin.INSTANCE.log(exception);
		}
		return new ArkinFactoryImpl();
	}

	/**
	 * Creates an instance of the factory.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ArkinFactoryImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public EObject create(EClass eClass) {
		switch (eClass.getClassifierID()) {
			case ArkinPackage.ROBOT: return createRobot();
			case ArkinPackage.BEHAVIOR: return createBehavior();
			case ArkinPackage.DISTANCE_SENSOR: return createDistanceSensor();
			case ArkinPackage.LIGHT_SENSOR: return createLightSensor();
			case ArkinPackage.ARBITER: return createArbiter();
			case ArkinPackage.TRANSITION: return createTransition();
			case ArkinPackage.STATE: return createState();
			case ArkinPackage.FSM: return createFSM();
			case ArkinPackage.DIFFERENTIAL_WHEEL: return createDifferentialWheel();
			case ArkinPackage.LED: return createLED();
			case ArkinPackage.ACTION_LED: return createActionLED();
			case ArkinPackage.ACTION_DIFFERENTIAL_WHEEL: return createActionDifferentialWheel();
			case ArkinPackage.NOT: return createNOT();
			case ArkinPackage.AND: return createAND();
			case ArkinPackage.OR: return createOR();
			case ArkinPackage.XOR: return createXOR();
			case ArkinPackage.LT: return createLT();
			case ArkinPackage.GT: return createGT();
			case ArkinPackage.EQUAL: return createEQUAL();
			case ArkinPackage.LTE: return createLTE();
			case ArkinPackage.GTE: return createGTE();
			case ArkinPackage.CONSTANTE: return createConstante();
			case ArkinPackage.ENTRY_STATE: return createEntryState();
			case ArkinPackage.BOOLEAN: return createBoolean();
			case ArkinPackage.TOUCH_SENSOR: return createTouchSensor();
			case ArkinPackage.PEN: return createPen();
			case ArkinPackage.ACTION_PEN: return createActionPen();
			default:
				throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier");
		}
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object createFromString(EDataType eDataType, String initialValue) {
		switch (eDataType.getClassifierID()) {
			case ArkinPackage.COLOR:
				return createColorFromString(eDataType, initialValue);
			default:
				throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier");
		}
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String convertToString(EDataType eDataType, Object instanceValue) {
		switch (eDataType.getClassifierID()) {
			case ArkinPackage.COLOR:
				return convertColorToString(eDataType, instanceValue);
			default:
				throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier");
		}
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Robot createRobot() {
		RobotImpl robot = new RobotImpl();
		return robot;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Behavior createBehavior() {
		BehaviorImpl behavior = new BehaviorImpl();
		return behavior;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public DistanceSensor createDistanceSensor() {
		DistanceSensorImpl distanceSensor = new DistanceSensorImpl();
		return distanceSensor;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public LightSensor createLightSensor() {
		LightSensorImpl lightSensor = new LightSensorImpl();
		return lightSensor;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Arbiter createArbiter() {
		ArbiterImpl arbiter = new ArbiterImpl();
		return arbiter;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Transition createTransition() {
		TransitionImpl transition = new TransitionImpl();
		return transition;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public State createState() {
		StateImpl state = new StateImpl();
		return state;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public FSM createFSM() {
		FSMImpl fsm = new FSMImpl();
		return fsm;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public DifferentialWheel createDifferentialWheel() {
		DifferentialWheelImpl differentialWheel = new DifferentialWheelImpl();
		return differentialWheel;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public LED createLED() {
		LEDImpl led = new LEDImpl();
		return led;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ActionLED createActionLED() {
		ActionLEDImpl actionLED = new ActionLEDImpl();
		return actionLED;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ActionDifferentialWheel createActionDifferentialWheel() {
		ActionDifferentialWheelImpl actionDifferentialWheel = new ActionDifferentialWheelImpl();
		return actionDifferentialWheel;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public NOT createNOT() {
		NOTImpl not = new NOTImpl();
		return not;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public AND createAND() {
		ANDImpl and = new ANDImpl();
		return and;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public OR createOR() {
		ORImpl or = new ORImpl();
		return or;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public XOR createXOR() {
		XORImpl xor = new XORImpl();
		return xor;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public LT createLT() {
		LTImpl lt = new LTImpl();
		return lt;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public GT createGT() {
		GTImpl gt = new GTImpl();
		return gt;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EQUAL createEQUAL() {
		EQUALImpl equal = new EQUALImpl();
		return equal;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public LTE createLTE() {
		LTEImpl lte = new LTEImpl();
		return lte;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public GTE createGTE() {
		GTEImpl gte = new GTEImpl();
		return gte;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Constante createConstante() {
		ConstanteImpl constante = new ConstanteImpl();
		return constante;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EntryState createEntryState() {
		EntryStateImpl entryState = new EntryStateImpl();
		return entryState;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public arkin.Boolean createBoolean() {
		BooleanImpl boolean_ = new BooleanImpl();
		return boolean_;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public TouchSensor createTouchSensor() {
		TouchSensorImpl touchSensor = new TouchSensorImpl();
		return touchSensor;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Pen createPen() {
		PenImpl pen = new PenImpl();
		return pen;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ActionPen createActionPen() {
		ActionPenImpl actionPen = new ActionPenImpl();
		return actionPen;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Color createColorFromString(EDataType eDataType, String initialValue) {
		Color result = Color.get(initialValue);
		if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");
		return result;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String convertColorToString(EDataType eDataType, Object instanceValue) {
		return instanceValue == null ? null : instanceValue.toString();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ArkinPackage getArkinPackage() {
		return (ArkinPackage)getEPackage();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @deprecated
	 * @generated
	 */
	@Deprecated
	public static ArkinPackage getPackage() {
		return ArkinPackage.eINSTANCE;
	}

} //ArkinFactoryImpl
